package com.jiazhong.继承;

public class Computer {
    private String cpu;
    private int memory;//内存
    private int disk;//硬盘

    public String getCpu() {
        return cpu;
    }

    public int getMemory() {
        return memory;
    }

    public int getDisk() {
        return disk;
    }

    public Computer(String cpu, int memory, int disk) {
        this.cpu = cpu;
        this.memory = memory;
        this.disk = disk;
    }

    public String getDetail(){
        return "cpu:" +cpu+" memory:"+memory+" disk:"+disk;
    }
}
class PC extends Computer{
    private String brand;

    public PC(String cpu, int memory, int disk,String brand) {
        super(cpu, memory, disk);
        this.brand=brand;
    }

    public String getBrand() {
        return brand;
    }

    public void printInfo(){
        System.out.print("PC信息=");
        System.out.println(getCpu()+" "+getMemory()+" "+getDisk()+" "+getBrand());
        //调用父类的getDetails方法，得到相关属性信息
        System.out.println(getDetail()+" brand:"+brand);
    }
}
class Test{
    public static void main(String[] args) {
        PC pc=new PC("intel",16,500,"IbM");
        pc.printInfo();
    }
}